﻿@{
    ViewData["Title"] = "UserList";
    Layout = "~/Views/_ViewImports.cshtml";
}
<script src="~/js/SystemManager/UsersList.js"></script>

<table id="user" lay-filter="user"></table>

@*头部工具栏*@
<script type="text/html" id="heard_tool">
     <div class="layui-row layui-col-space15">
      <div class="layui-col-md3">
        <input type="text" id="name" name="name" placeholder="用户名/登录名" autocomplete="off" class="layui-input">
      </div>
      <div class="layui-col-md3">
        <a class="layui-btn layui-btn-sm power-show" lay-event="search" lay-menu-code="SystemManagerAction:QueryPagesUsers" ><i class="layui-icon layui-icon-search" /></a>
        <a class="layui-btn layui-btn-sm power-show" lay-event="add" lay-menu-code="SystemManagerAction:AddUser" ><i class="layui-icon layui-icon-addition" /></a>
        <a class="layui-btn layui-btn-sm power-show" lay-event="batchDel" lay-menu-code="SystemManagerAction:BatchDelete" ><i class="layui-icon layui-icon-delete" /></a>
      </div>
    </div>
</script>

@*行工具栏*@
<script type="text/html" id="line_tool">
    <a class="layui-btn layui-btn-xs power-show" lay-event="set_admin" lay-menu-code="SystemManagerAction:UpdateIsAdminById" >
        {{# if(!d.isAdmin){ }}
            设置超级管理员
        {{# }else{  }}
            设置普通用户
        {{# } }}
    </a>
    {{# if(!d.isAdmin){ }}
        <a class="layui-btn layui-btn-xs power-show" lay-event="assign_role" lay-menu-code="SystemManagerAction:UpdateRoleIdsById,SystemManagerAction:QueryRolesByUserId" >分配角色</a>
    {{# } }}
    <a class="layui-btn layui-btn-xs power-show" lay-event="delete" lay-menu-code="SystemManagerAction:DeleteOne" ><i class="layui-icon layui-icon-delete" /></a>
</script>

@*分配角色html*@
<template id="assign-role-template">
    <script src="~/lib/layui/xm-select.js"></script>
    <ul class="layui-form layui-form-pane" style="margin: 15px;">
        <li class="layui-form-item">
            <label class="layui-form-label">角色：</label>
            <div class="layui-input-inline">
                <div class="xm-select-demo-alert" id="role_select"></div>
            </div>
        </li>
        <li class="layui-form-item" style="text-align:center;">
            <button type="submit" class="layui-btn" lay-submit lay-filter="save">保存</button>
        </li>
    </ul>
</template>

@*添加用户*@
<template id="adduser-template">
    <ul class="layui-form layui-form-pane" style="margin:15px;">
        <li class="layui-form-item">
            <label class="layui-form-label">用户名</label>
            <div class="layui-input-block">
                <input type="text" name="name" required lay-verify="required" placeholder="请输入用户名" autocomplete="off" class="layui-input">
            </div>
        </li>
        <li class="layui-form-item">
            <label class="layui-form-label">登录名</label>
            <div class="layui-input-block">
                <input type="text" name="userName" required lay-verify="required" placeholder="请输入登录名" hidden autocomplete="new-username" class="layui-input">
            </div>
        </li>
        <li class="layui-form-item">
            <label class="layui-form-label">密码</label>
            <div class="layui-input-block">
                <input type="password" id="password" name="password" required lay-verify="pwd" placeholder="请输入密码" hidden autocomplete="new-password" class="layui-input">
            </div>
        </li>
        <li class="layui-form-item">
            <label class="layui-form-label">确认密码</label>
            <div class="layui-input-block">
                <input type="password" name="confirmPwd" required lay-verify="confirmPwd" placeholder="请输入确认密码" autocomplete="off" class="layui-input">
            </div>
        </li>
        <li class="layui-form-item">
            <label class="layui-form-label">手机号</label>
            <div class="layui-input-block">
                <input type="text" name="mobile" placeholder="请输入手机号" autocomplete="on" class="layui-input">
            </div>
        </li>
        <li class="layui-form-item">
            <label class="layui-form-label">邮箱</label>
            <div class="layui-input-block">
                <input type="text" name="email" placeholder="请输入邮箱" autocomplete="on" class="layui-input">
            </div>
        </li>
        <li class="layui-form-item" style="text-align:center;">
            <button type="submit" class="layui-btn" lay-submit lay-filter="save">保存</button>
        </li>
    </ul>
</template>